<template>
  <div>
    <NuxtLayout>
      <NuxtRouteAnnouncer />
      <NuxtPage />
    </NuxtLayout>
  </div>
</template>


<script lang="ts">
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { defineComponent, ref, onMounted, reactive, toRefs } from "vue";
import {useUserState} from '@/states/pinia'
gsap.registerPlugin(ScrollTrigger);

export default defineComponent({

  setup() {


    const routers = useRouter()
    const State  = useUserState()

    const LoginCheck = async() => {
      State.restoreFromLocalStorage()
      if(State.userinfo){
        routers.push({
          path: '/'
        })
      }
      else{
        routers.push({
          path: 'login'
        })
      }
    }


    onMounted(() => {
      LoginCheck()
    })

  }

})
</script>
